🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / database / src / commonMain / kotlin / org / meshtastic / core / database / entity / MaintenanceUf2CacheEntity.kt
Displaying Raw • Download
core/database/src/commonMain/kotlin/org/meshtastic/core/database/entity/MaintenanceUf2CacheEntity.kt bd2863243bab6eb213401d949839a2bc74dde7e2 (bd286324) Text, 2.32 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.database.entity
Tff7b72import T7ee787androidx.room3.ColumnInfo
Tff7b72import T7ee787androidx.room3.Entity
Tff7b72import T7ee787androidx.room3.PrimaryKey
Tff7b72import T7ee787kotlinx.serialization.Serializable
Tff7b72import T7ee787kotlinx.serialization.json.Json
Tff7b72import T7ee787org.meshtastic.core.model.MaintenanceUf2Manifest
T8b949e/** Lenient so decoding a cached column survives a model that gained fields since it was written (forward-compat). */
Tff7b72private Tff7b72val Te6edf3entityJson Tff7b72= Te6edf3Json Tb4b4b4{ Te6edf3ignoreUnknownKeys Tff7b72= Tff7b72true Tb4b4b4}
T8b949e/**
* Single-row cache of the maintenance-UF2 manifest (`/resource/maintenanceUf2`), pre-serialized as one JSON column —
* the only reader ([org.meshtastic.core.data.repository.MaintenanceUf2RepositoryImpl]) always wants the whole envelope,
* so a granular per-field schema would add migration surface for no query anyone runs. [id] is always [SINGLETON_ID];
* this table only ever holds one row.
*/
Tf0883e@Serializable
Tf0883e@EntityTb4b4b4(Te6edf3tableName Tff7b72= Ta5d6ff"Ta5d6ffmaintenance_uf2_cacheTa5d6ff"Tb4b4b4)
Tff7b72data Tff7b72class T56d364MaintenanceUf2CacheEntityTb4b4b4(
Tf0883e@PrimaryKey Tff7b72val Te6edf3idTb4b4b4: Tffa657Int Tff7b72= Te6edf3SINGLETON_IDTb4b4b4,
Tf0883e@ColumnInfoTb4b4b4(Te6edf3name Tff7b72= Ta5d6ff"Ta5d6ffmanifest_jsonTa5d6ff"Tb4b4b4) Tff7b72val Te6edf3manifestJsonTb4b4b4: Tffa657StringTb4b4b4,
Tb4b4b4) Tb4b4b4{
Tff7b72companion Tff7b72object Tb4b4b4{
Tff7b72const Tff7b72val Te6edf3SINGLETON_ID Tff7b72= T79c0ff0
Tb4b4b4}
Tb4b4b4}
Tff7b72fun Te6edf3MaintenanceUf2ManifestTb4b4b4.Td2a8ffasEntityTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3MaintenanceUf2CacheEntityTb4b4b4(Te6edf3manifestJson Tff7b72= Te6edf3entityJsonTb4b4b4.Te6edf3encodeToStringTb4b4b4(Tff7b72thisTb4b4b4)Tb4b4b4)
T8b949e// A malformed column value decodes to an empty (all-defaults) manifest rather than propagating the failure —
T8b949e// consistent with the bundled-asset seed path.
Tff7b72fun Te6edf3MaintenanceUf2CacheEntityTb4b4b4.Td2a8ffasExternalModelTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3MaintenanceUf2Manifest Tff7b72=
Te6edf3runCatching Tb4b4b4{ Te6edf3entityJsonTb4b4b4.Te6edf3decodeFromStringTff7b72<Te6edf3MaintenanceUf2ManifestTff7b72>Tb4b4b4(Te6edf3manifestJsonTb4b4b4) Tb4b4b4}
Tb4b4b4.Te6edf3getOrDefaultTb4b4b4(Te6edf3MaintenanceUf2ManifestTb4b4b4(Tb4b4b4)Tb4b4b4)
Served by rngit 1.5.0 - Generated in 0.04s